package cn.gok.controller;

import cn.gok.entity.Course;
import cn.gok.service.StudentService;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: LKSV
 * @Description:
 * @Date:Created in 16:48 2021/8/1
 */
@Controller
public class StudentPageController {
    @Resource
    private StudentService studentService;


    @GetMapping("/student/selectClassPage")
    @ResponseBody
    public List<Course> selectStudentClassPage(Integer id) {

        PageHelper.startPage(1, 2, true);
        List<Course> courses = this.studentService.selectByClass(id);

        for (Course course : courses) {
            System.out.println(course);

        }
        return studentService.selectByClass(id);
    }
}